<!DOCTYPE html>
<html style="height: 100%">
   <head>
       <meta charset="utf-8">
   </head>
   <body style="height: 100%; margin: 0">
       <div id="container" style="height: 100%"></div>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-gl/echarts-gl.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/dataTool.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/china.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/world.js"></script>
       <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=ZUONbpqGBsYGXNIYHicvbAbM"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/bmap.min.js"></script>
       <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/simplex.js"></script>
       <script type="text/javascript">
var dom = document.getElementById("container");
var myChart = echarts.init(dom);
var app = {};
option = null;
app.title = '环形图';

option = {
    tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b}: {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        x: 'left',
        data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
    },
    series: [
        {
            name:'访问来源',
            type:'pie',
            radius: ['50%', '70%'],
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                }
            },
            itemStyle: {
                color: {
                    type: 'linear',
                    x: 0,
                    y: 0,
                    x2: 0,
                    y2: 1,
                    colorStops: [{
                        offset: 0, color: 'red' // 0% 处的颜色
                    }, {
                        offset: 1, color: 'blue' // 100% 处的颜色
                    }],
                    globalCoord: false // 缺省为 false
                }
            },
            
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:[
                {value:335, name:'直接访问',itemStyle: {
                color: {
                    colorStops: [{
                        offset: 0, color: '#779DFF ' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#1E47B1' // 100% 处的颜色
                    }]
                }
            }},
                {value:310, name:'邮件营销',itemStyle: {
                color: {
                    colorStops: [{
                        offset: 0, color: '#4574EF' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#0C3399' // 100% 处的颜色
                    }]
                }
            }},
                {value:234, name:'联盟广告',itemStyle: {
                color: {
                    colorStops: [{
                        offset: 0, color: '#650E8D' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#9E42C7' // 100% 处的颜色
                    }]
                }
            }},
                {value:135, name:'视频广告',itemStyle: {
                color: {
                    colorStops: [{
                        offset: 0, color: '#8D094D' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#D33B76' // 100% 处的颜色
                    }]
                }
            }},
                {value:1548, name:'搜索引擎',itemStyle: {
                color: {
                    colorStops: [{
                        offset: 0, color: '#9E42C7' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#650E8D' // 100% 处的颜色
                    }]
                }
            }}
            ]
        }
    ]
};
;
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
       </script>
   </body>
</html>